/*-----------------------------------------------------------------------------------
Name: Sangyoon Park
Date: January 23 2023
This do file does : 
	Create variable labels and export codebook
-----------------------------------------------------------------------------------*/
clear all
set matsize 10000
set maxvar 10000
set more off


#delim ;

*** Load dataset;

import excel "${raw_path}/INTERMEDIARY_COMBINESURVEY_CLEAN.xlsx", firstrow;

*** Label dataset;

lab data "This file contains intermediary data collected from baseline and two followup surveys";


*** Label baseline variables;

lab var traderid "unique id of trader";
lab var strata "[Base] strata assigned to trader";
lab var st_tgroup "[Base] treatment group assigned to trader";
lab var latitude "[Base] latitude of trader's facility";
lab var longitude "[Base] longitude of trader's facility";
lab var age"[Base_B-3] experience in packing/trading business";
lab var size_facility"[Base_B-4] size of collection/packing facility";
lab var buy_farmer"[Base_C-1a] percent of volume purchased from farmers";
lab var buy_collector"[Base_C-1c] percent of volume purchased from collectors";
lab var cooperative"[Base] trader type is cooperative";

lab var cost_material_fu0"[Base_C-4] total material costs";
lab var cost_labor_fu0"[Base_C-5] total hired labor costs";
lab var cost_utility_fu0"[Base_C-6] total utility costs";

lab var trade_volume_fu0"[Base_C-7a] total volume purchased";
lab var buy_avgprice_fu0"[Base_C-7b] average price purchased from seller";
lab var sell_avgprice_fu0"[Base_C-7c] average price sold to buyer";
lab var totalrev_fu0"[Base_C-7d] total revenue from business";

lab var ghp_score_fu0"[Base_E-2] total score on trader's GAP";

lab var export_china"[Base_F-1a] have ever exported to china";
lab var export_asian"[Base_F-1b] have ever exported to other asian countries";
lab var export_other"[Base_F-1cd] have ever exported to EU or US";
lab var barrier_q1"[Base_F-2a] major barrier = no access or information";
lab var barrier_q2"[Base_F-2b] major barrier = no technical knowledge";
lab var barrier_q3"[Base_F-2c] major barrier = no money for investment";
lab var barrier_q4"[Base_F-2d] major barrier = not profitable enough";
lab var barrier_q5"[Base_F-2e] major barrier = too risky to invest";


*** Label 1st followup survey variables;

lab var attrit_fu1"[FU1] fail to survey in 1st round followup";

lab var cost_material_fu1"[FU1_B-1] total material costs";
lab var cost_labor_fu1"[FU1_B-2a] total hired labor costs";
lab var cost_utility_fu1"[FU1_B-2b] total utility costs";

lab var trade_volume_fu1"[FU1_B-4a] total volume purchased";
lab var buy_avgprice_fu1"[FU1_B-4b] tverage price purchased from seller";
lab var sell_avgprice_fu1"[FU1_B-4c] tverage price sold to buyer";
lab var totalrev_fu1"[FU1_B-4d] total revenue from business";

lab var gaptest_score_fu1"[FU1_D] total score on gap knowledge test (max=10)";
lab var ghp_score_fu1"[FU1A_1] total score on facility audit with GAP standards";

*** Label 2nd followup survey variables;

lab var attrit_fu2"[FU2] fail to survey in 1st round followup";

lab var cost_material_fu2"[FU2_B-1] total material costs";
lab var cost_labor_fu2"[FU2_B-2a] total hired labor costs";
lab var cost_utility_fu2"[FU2_B-2b] total utility costs";

lab var trade_volume_fu2"[FU2_B-4a] total volume purchased";
lab var buy_avgprice_fu2"[FU2_B-4b] tverage price purchased from seller";
lab var sell_avgprice_fu2"[FU2_B-4c] tverage price sold to buyer";
lab var totalrev_fu2"[FU2_B-4d] total revenue from business";


save "${data_path}/INTERMEDIARY_COMBINESURVEY_CLEAN", replace;


*** Create codebook for datafile;


log using "${out_path}/codebook_intermediary_combinesurvey_clean.log", replace;

codebook,compact;

log close;

clear;









